import { http } from "../utils/request"

export interface userinfo {
  number: string
  avatar: string
  name: string
  phone: string
}

interface tokenData {
  data: userinfo,
  msg: string,
  code: number
}
export interface  taskInfo{
  taskAmounts: number,
  completedAmounts: number,
  transportMileage: number,
}
interface taskData {
  data: taskInfo,
  msg: string,
  code: number
}
export  class paramsuserData {
  month: string
  year: string

  constructor(month: string, year: string) {
    this.month = (new Date().getMonth() + 1).toString()
    this.year = (new Date().getFullYear()).toString()
  }
}

export const user = (): Promise<tokenData> => {
  return http.get<tokenData>("/users")
}
export const taskinfo = (data:paramsuserData): Promise<taskData> => {
  return http.get<taskData>("/users/taskReport",data)
}